home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Hardware / BlizKick / Modules / FixGetMsg.ASM < prev    next >
Encoding:
Assembly Source File  |  2002-03-13  |  1.9 KB  |  104 lines

  1. ; FILE: Source:modules/FixGetMsg.ASM          REV: 2 --- Fix GetMsg() bug
  2.  
  3. ;
  4. ; FixGetMsg - Fix 68060 GetMsg() loop hang
  5. ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  6. ; Written by Harry "Piru" Sintonen.
  7. ; This source code is Public Domain.
  8. ; Idea stolen from FixGetMsg by Frederick H. G. Wright II <fw@well.com>.
  9. ;
  10. ; This module fixes the hang if GetMsg() is called in tight loop
  11. ; on 68060.
  12. ;
  13. ; V1.0 - 27th Mar 2000
  14. ; Original release.
  15. ;
  16. ; V1.1 - 31st Jan 2001
  17. ; Fixed a serious bug, the new GetMsg() trashed zeropage in some rare
  18. ; conditions.
  19. ;
  20. ;    - Piru
  21. ;
  22.  
  23.     incdir    "include:"
  24.     include    "exec/ports.i"
  25.     include    "exec/execbase.i"
  26.  
  27.     include    "exec/exec_lib.i"
  28.  
  29.     include    "blizkickmodule.i"
  30.  
  31.  
  32.     SECTION    MODULE,CODE
  33. _DUMMY_LABEL
  34.  BK_MOD BKMF_SingleMode,_end,(RTF_COLDSTART)<<24+37<<16+NT_UNKNOWN<<8+104,_name,_idstr,_init
  35.  
  36. ; Singlemode on,
  37. ; COLDSTART module, requires KS V37.x or better, module type NT_UNKNOWN, priority 104.
  38.  
  39. _init    movem.l    d0-d1/a0-a1/a6,-(sp)
  40.     move.l    (4).w,a6
  41.  
  42.     lea    (newGetMsg,pc),a0
  43.     move.l    a0,d0
  44.     move.w    #_LVOGetMsg,a0
  45.     move.l    a6,a1
  46.     jsr    (_LVOForbid,a6)
  47.     jsr    (_LVOSetFunction,a6)
  48.     jsr    (_LVOPermit,a6)
  49.  
  50.     movem.l    (sp)+,d0-d1/a0-a1/a6
  51.     rts
  52.  
  53.     CNOP    0,8
  54. newGetMsg
  55.     lea    (MP_MSGLIST,a0),a0
  56.     moveq    #0,d0
  57.     cmp.l    (LH_TAIL+LN_PRED,a0),a0
  58.     beq.b    .exit
  59.  
  60.     move.w    #$4000,$DFF09A
  61.     addq.b    #1,(IDNestCnt,a6)
  62.     move.l    (a0),a1
  63.     move.l    (a1),d0
  64.     beq.b    .exit2
  65.     move.l    d0,(a0)
  66.     exg    d0,a1
  67.     move.l    a0,(LN_PRED,a1)
  68. .exit2    subq.b    #1,(IDNestCnt,a6)
  69.     bge.b    .exit
  70.     move.w    #$C000,$DFF09A
  71. .exit    rts
  72.  
  73.  
  74. ; here is the original function:
  75.  
  76.     IFGT    0
  77.  
  78. _LVOGetMsg
  79.     lea    (MP_MSGLIST,a0),a0
  80.     move.w    #$4000,$DFF09A
  81.     addq.b    #1,(IDNestCnt,a6)
  82.     move.l    (a0),a1
  83.     move.l    (a1),d0
  84.     beq.b    .exit2
  85.     move.l    d0,(a0)
  86.     exg    d0,a1
  87.     move.l    a0,(LN_PRED,a1)
  88. .exit2    subq.b    #1,(IDNestCnt,a6)
  89.     bge.b    .exit
  90.     move.w    #$C000,$DFF09A
  91. .exit    rts
  92.  
  93.     ENDC
  94.  
  95. _name    dc.b    'FixGetMsg',0
  96. _idstr    dc.b    'FixGetMsg 1.1 (31.1.01)',0
  97.     CNOP    0,2
  98. _end
  99.  
  100.     SECTION    VERSION,DATA
  101.  
  102.     dc.b    '$VER: FixGetMsg_MODULE 1.1 (31.1.01)',0
  103.  
  104.